/*
 * Copyright (c) 2003-2004, Inversoft, All Rights Reserved
 *
 * This software is distribuable under the GNU Lesser General Public License.
 * For more information visit gnu.org.
 */
package org.emergent.antbite.savant;


import java.io.File;


/**
 * <p>
 * This interface is a workflow processor that is used to
 * locate artifacts that a project depends on.
 * </p>
 *
 * @author  Brian Pontarelli
 */
public interface Process {

    /**
     * <p>
     * This method attempts to locate the dependencies of the given Artifact using
     * the an XML dependency file. If the process can resolve the dependency it
     * should update the given artifact and return true.
     * </p>
     *
     * @param   artifact The artifact to update with the resolved dependencies.
     * @param   localCache The local cache store to cache the dependency XML file
     *          if it is resolved.
     * @return  True if the artifact was updated, false otherwise.
     * @throws  SavantException If the resolution failed or the XML was corrupt.
     */
    boolean resolveArtifactDependencies(Artifact artifact, LocalCacheStore localCache)
    throws SavantException;

    /**
     * <p>
     * Attempts to fetch the artifact using the definition given. If the artifact
     * can be found, it is first copied to the localCache using the LocalCacheStore
     * interface given. After it has been stored locally, it is returned as a File
     * object to the locally cached copy.
     * </p>
     *
     * @param   artifact The artifact to locate
     * @param   localCache The LocalCacheStore interface that must be called in
     *          order to store a local copy of the artifact.
     * @return  The file that references the artifact from the localCache
     */
    File fetch(Artifact artifact, LocalCacheStore localCache)
    throws SavantException;

    /**
     * Validates that the process is configured correctly.
     *
     * @throws  SavantException If the process is not configured correctly
     */
    void validate() throws SavantException;
}